package models.common.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Transient;

import play.db.jpa.Model;

import common.constants.ConfConst;
import common.constants.Constants;
import common.utils.Security;
/**
 * 批量上传
 * @author liaijun
 * @createDate 2018/01/06
 */
@Entity
public class t_batch_upload extends Model{

    /**
     *  文件名称
     */
    public String file_name;

    /**
     * 用户id 
     */
    public long user_id;


    /**
     *文件地址
     */
    public String file_url;
   
    /**
     *  添加时间
     */
    public Date time;
    
    /**
     * 类型  0 债务 1 债权
     */
    public int type;
    
    /**
     * 状态0 未申请1 已申请
     * @mbggenerated
     */
    public int status;

    public  UploadStatus getUploadStatus()
    {
    	return UploadStatus.getStatusEnum(this.status);
    }
    
    
    public enum UploadStatus{
    	
    	/**
    	 * 未申请
    	 */
    	NO_PAY(0,"未申请"),
    	
    	/**
    	 *  已申请
    	 */
    	UN_FINISHED(1,"已申请"),
    	
    	IS_DEL(-1,"已删除")
    	
    	;
    	
    	

    	
    	public int code;
    	public String value;
    	
    	private UploadStatus(int code,String value)
    	{
    		this.code = code;
    		this.value = value;
    	}
    	
    	public static UploadStatus getStatusEnum(int code){
    		UploadStatus [] status = UploadStatus.values();
    		for (UploadStatus statu : status) {
				if (statu.code == code) {
					return statu;
				}
			}
    		return null;
    	}
    	
    }
    

    /**加密ID*/
	@Transient
	public String sign;
	
    public String getSign () {
		return Security.addSign(this.id, Constants.BID_ID_SIGN, ConfConst.ENCRYPTION_KEY_DES);
	}
   
}